package logger;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;

public class LoggerSemCDI implements Logger {

	@Override
	public void gravar(String msg) {
		try {
			File file;
			if (System.getProperty("os.name").equals("Linux")) {
				file = new File("/home/norbert/logCdi.txt");
			} else {
				file = new File("d:\\logCdi.txt");
			}
			if (!file.exists()) {
				file.createNewFile();
			}

			FileWriter fw = new FileWriter(file, true);
			BufferedWriter bw = new BufferedWriter(fw);
			bw.newLine();
			bw.write(msg);
			bw.close();

		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}